package com.grantheath.erebus.controller.transitionManagers.linearTransitionManagers
{
	import com.grantheath.erebus.model.enum.notifications.ErebusPageNotifications;
	import com.grantheath.erebus.model.enum.names.ErebusProxyNames;
	import com.grantheath.erebus.model.interfaces.IErebusSiteTreeProxy;
	import com.grantheath.erebus.model.interfaces.IErebusPageNode;

	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	import org.puremvc.as3.interfaces.INotification;

	/**
	 * @author grantheath
	 */
	public class ErebusPageHiddenCommand extends SimpleCommand implements ICommand 
	{
		override public function execute(notification : INotification) : void
		{
			var siteTreeProxy : IErebusSiteTreeProxy = facade.retrieveProxy(ErebusProxyNames.SITE_TREE_PROXY) as IErebusSiteTreeProxy;
			var pageNode : IErebusPageNode = notification.getBody() as IErebusPageNode;
			
			siteTreeProxy.unregisterDisplayedPageNode(pageNode);
			trace("unregistering displayed node: " + pageNode + "\tdisplayed nodes: " + siteTreeProxy.displayedPages);
			sendNotification(ErebusPageNotifications.UNINITIALIZE_PAGE, pageNode);
		}
	}
}